<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 1190px;
            position: relative;
        }

        .close {
            width: 20px;
            height: 20px;
            text-align: center;
            background-color: #fff;
            position: absolute;
            top: -9px;
            right: -4px;
        }
    </style>
</head>

<body>
    <div class="box">
        <img src="./images/jd.webp" alt="">
        <div class="close">x</div>
    </div>
    <script>
        // 点击x 关闭这个图
        // 1、获取dom元素
        const btn = document.querySelector('.close')
        const box = document.querySelector('div')
        // 2、注册事件  监听事件
        btn.addEventListener('click', function () {
            // 鼠标点击关闭(隐藏)整个图片
            box.style.display = 'none';
        })
    </script>
</body>

</html>